package com.authService.enums;

import com.common.operationLog.service.OperationLogModuleType;
import lombok.AllArgsConstructor;

import java.util.Objects;

@AllArgsConstructor
public enum OperationLogTypeEnum implements OperationLogModuleType {

    // 角色
    ROLE_SAVE(OperationLogModuleEnum.ROLE, "role_save" , "角色新增"),
    ROLE_UPDATE(OperationLogModuleEnum.ROLE, "role_save" , "角色修改"),

    // 权限
    PERMISSION_SAVE(OperationLogModuleEnum.PERMISSION, "permission_save" , "权限新增"),
    PERMISSION_UPDATE(OperationLogModuleEnum.PERMISSION, "permission_update" , "权限修改"),

    ;

    /**
     * 日志模块
     */
    private OperationLogModuleEnum operationLogModuleEnum;

    /**
     * 日志类型code
     */
    private String  typeCode;

    /**
     * 日志类型name
     */
    private String  typeName;


    @Override
    public String getModuleCode() {
        return Objects.nonNull(operationLogModuleEnum) ? operationLogModuleEnum.getModuleCode() : null;
    }

    @Override
    public String getModuleName() {
        return Objects.nonNull(operationLogModuleEnum) ? operationLogModuleEnum.getModuleName() : null;
    }

    @Override
    public String getTypeCode() {
        return typeCode;
    }

    @Override
    public String getTypeName() {
        return typeName;
    }
}
